python 文本输入框 您所在的位置:网站首页 python word 文本框 python 文本输入框

python 文本输入框

2022-06-08 16:55| 来源: 网络整理| 查看: 265

Python3 tkinter窗口中如何输入和输出

意思就是你要将入的内容进行翻

如果内容较多的话,用Text吧,如要Entry的话也可以~

随便一个示例(Tkinter

改成tkinter,主要是textvariable

和get()):#! /usr/bin/env python#! encoding:utf-8

# Filename:test.py

from Tkinter import *

root = Tk()

root.title("Entry Test")

v1 = StringVar()

v2 = StringVar()

v3 = StringVar()

#设置entry为只读属性

Entry(root, width=30,textvariable=v1, stat="readonly").pack()

v1.set("readonly")

#默认情况下下Entry的状态为normal

Entry(root, width=30,textvariable=v2).pack()

v2.set("normal")

#将输入的内容用密文的形式显示

entry = Entry(root, width=30,textvariable=v3)

v3.set("password")

entry.pack()

entry["show"] = "*"

root.mainloop()

python3中没有tkMessageBox这个module,怎么办?难道要自己写那样的信息框?

Python3:from tkinter.messagebox import showwarning

问:Python3怎样用tk整一个文本输入框

直接.get():

Exception in Tkinter callback

Traceback (most recent call last):

File "/usr/lib/python3.4/tkinter/__init__.py", line 1533, in __call__

return self.func(*args)

File "./print.py", line 49, in print

print(self.TextInput.get())

TypeError: get() missing 1 required positional argument: 'index1'

python3.0 tk的使用

有什么问题 ,刚好之前写过一些关于py3 tk西,可以一起探讨,给你一个:import urllib, urllib.request

import os, re

from tkinter import *

import tkinter.ttk

import ctypes

import threading, time

def RunApp():

handler = None;

operator = "open";

fpath = "D:\SoftWare\Chrome\Chrome\chrome.exe";

param = '-user-data-dir="D:\SoftWare\Chrome\profil';

dirpath = 'D:\SoftWare\Chrome\Chrome';

ncmd = 1;

shell32 = ctypes.windll.LoadLibrary("shell32.dll");

shell32.ShellExecuteW(handler,operator,fpath,param,dirpath,ncmd);

def callbackfunc(blocknum, blocksize, totalsize):

'''回调函数

@blocknum: 已经下载的数据块

@blocksize: 数据块的大小

@totalsize: 远程文件的大小

'''

percent = 100.0 * blocknum * blocksize / totalsize

if percent > 100:

percent = 100

prb['value'] = percent

lbjd['text'] = '更新进度 %0.2f ' % percent   '%'

#print(percent)

def prbadd():

prb['value']  = 1

def Load():

time.sleep(0.5)

t1 = threading.Thread(target=down)

t1.start()

def down():

nfn = vel '_chrome_installer.exe'

print('hehe')

urllib.request.urlretrieve(link,nfn,callbackfunc)

os.system('update.bat ' nfn)

#print('更新完成')

#os.system('PAUSE')

#os.system('''start D:\SoftWare\Chrome\Chrome\chrome.exe -user-data-dir="D:\SoftWare\Chrome\profil"''')

RunApp()

root.quit()

html = urllib.request.urlopen('http://down.tech.sina.com.cn/page/40975.html').read().decode('gbk')

t = re.search('(?正式版-)',html)

link = 'http://down.tech.sina.com.cn'   t.group(0)

title = html[html.index('')   7 : html.index('')]

vel = title[title.rindex('/') 1:title.index('】') - 3]

ls = os.listdir('../Chrome/')

for fn in ls:

if fn.find('exe') == -1:

oldvel = fn

break

if oldvel != vel:

root = Tk()

root.title('Chrome更新工具')

# root.attributes("-toolwindow", 1)

lbjd = Label(root,text='更新进度')

lbjd.pack()

prb = tkinter.ttk.Progressbar(root, length=400, maximum=100.0, value=0)

prb.pack()

sw = root.winfo_screenwidth()

sh = root.winfo_screenheight()

root.geometry('410x50 ' str(int((sw-410)/2)) ' ' str(int((sh-50)/2)))

#root.bind('',Load)

Load()

root.mainloop()

else:

#print('已经是最新版本')

RunApp()

#os.system('''start D:\SoftWare\Chrome\Chrome\chrome.exe -user-data-dir="D:\SoftWare\Chrome\profil"''')

#print(title)

这个是我自己更新chrome用的

版权声明:本站所有文章皆为原创,欢迎转载或转发,请保留网站地址和作者信息。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有